This page last changed on Dec 22, 2008 by scytacki.

This is useful to fix annoying issues between certain email senders and email clients.
The email can be sent through procmail, and then a more advanced language can be used to parse the email, modify it and save resend it.

PHP

Other links:

Issues:
These libraries don't do round trips very well. The structure created by mimeDecode cannot just be modified and turned back into a string again.

Notes:
for testing command line php scripts the following error handler is useful to see errors:

  // A custom error handler                                                                             
function CliErrorHandler($errno, $errstr, $errfile, $errline) {
  fwrite(STDERR,"$errstr in $errfile on $errline\n");
}
// Tell PHP to use the error handler                                                                    
set_error_handler('CliErrorHandler');

Ruby

The Rmail library looks better than the php one. It seems like it would be easy to go from mime message to a struct and back again. http://www.rfc20.org/rubymail/
There is also a rubyfilter library which uses rmail which might be a replacement for procmail. However it seems like it isn't maintained much anymore. The main website is missing.
This page has some more details: http://www.securityfocus.com/tools/3029

Document generated by Confluence on Jan 27, 2014 16:56